package me.thinkjet.sso.client.validation;

import java.util.Collections;
import java.util.Date;
import java.util.Map;

import me.thinkjet.sso.client.util.CommonUtils;

public final class AssertionImpl implements Assertion {

	private static final long serialVersionUID = -7767943925833639221L;

	private final Date validFromDate;

	private final Date validUntilDate;

	private final Map<String, Object> attributes;

	private final String id;

	public AssertionImpl(final String id) {
		this(id, Collections.<String, Object> emptyMap());
	}

	public AssertionImpl(final String id, final Map<String, Object> attributes) {
		this(id, new Date(), null, attributes);
	}

	public AssertionImpl(final String id, final Date validFromDate,
			final Date validUntilDate, final Map<String, Object> attributes) {
		this.id = id;
		this.validFromDate = validFromDate;
		this.validUntilDate = validUntilDate;
		this.attributes = attributes;

		CommonUtils.assertNotNull(this.id, "principal cannot be null.");
		CommonUtils.assertNotNull(this.validFromDate,
				"validFromDate cannot be null.");
		CommonUtils
				.assertNotNull(this.attributes, "attributes cannot be null.");
	}

	public Date getValidFromDate() {
		return this.validFromDate;
	}

	public Date getValidUntilDate() {
		return this.validUntilDate;
	}

	public Map<String, Object> getAttributes() {
		return this.attributes;
	}

	public String getId() {
		return this.id;
	}
}
